/**
 * @author Fang Lu, fanglupku@gmail.com
 * 2011-5-14
 */
package com.autotag.nlp;

public class NLPToken {
	public static final int TYPE_ERROR = -1;
	public static final int TYPE_V = 0;
	public static final int TYPE_N = 1;
	public static final int TYPE_OTHER = 2;
	private String content;
	private String tag;
	private int index;
	private int type;
	public NLPToken(String taggedString, int index){
		int lastSeperator = taggedString.lastIndexOf("/");
		if (lastSeperator <= 0 || lastSeperator == taggedString.length()){
			this.content = "";
			this.tag = "";
			this.index = index;
			this.type = -1;
		}else{
			this.content = new String(taggedString.substring(0, lastSeperator));
			this.tag = new String(taggedString.substring(lastSeperator+1, taggedString.length()));
			if (tag.startsWith("V")){
				this.type = TYPE_V;
			}else if (tag.startsWith("N")){
				this.type = TYPE_N;
			}else {
				this.type = TYPE_OTHER;
			}
		}
	}
	public NLPToken(String content, String tag, 
			int index, int type){
		this.content = content;
		this.tag = tag;
		this.index = index;
		this.type = type;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getTag() {
		return tag;
	}
	public void setTag(String tag) {
		this.tag = tag;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public int getType() {
		return type;
	}
	
}
